//
//  TixianItemView.m
//  ZDB
//
//  Created by 微笑吧阳光 on 2020/5/28.
//  Copyright © 2020 ZDB. All rights reserved.
//

#import "TixianItemView.h"

@interface TixianItemView()

@end
@implementation TixianItemView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame
                   
{
    if (self = [super initWithFrame:frame])
    {
   
        [self setUI];
    }
    return self;
}

-(void)setUI{
    
    self.selectBtn = [BBControl createButtonWithFrame:CGRectZero target:nil SEL:nil title:@""];
      [self addSubview:self.selectBtn];
    self.titleLab.textColor = [UIColor colorWithHexString:@"#333333"];
    KViewBorder(self.selectBtn, [UIColor colorWithHexString:@"#e8e8e8"], 0.5);
    [self.selectBtn setBackgroundImage:nil forState:0];
    KViewRadius(self.selectBtn, 2);
    self.titleLab = [UILabel new];;
    self.titleLab.font = [UIFont systemFontOfSize:14];
    self.titleLab.textColor = [UIColor colorWithHexString:@"#333333"];
    self.titleLab.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.titleLab];
    
    
       self.subTitleLab = [UILabel new];;
       self.subTitleLab.font = [UIFont systemFontOfSize:12];
       self.subTitleLab.textColor = [UIColor colorWithHexString:@"#adadad"];
       self.subTitleLab.textAlignment = NSTextAlignmentCenter;
       [self addSubview:self.subTitleLab];
    
    
}
-(void)setIsSeclec:(BOOL)isSeclec{
    _isSeclec = isSeclec;
    
    if (isSeclec == YES) {
        self.titleLab.textColor = [UIColor colorWithHexString:@"#e98053"];
        KViewBorder(self.selectBtn, [UIColor clearColor], 0.5);
        [self.selectBtn setBackgroundImage:[UIImage imageNamed:@"tixian_xuanzhong"] forState:0];
    }else{
        self.titleLab.textColor = [UIColor colorWithHexString:@"#333333"];
        KViewBorder(self.selectBtn, [UIColor colorWithHexString:@"#e8e8e8"], 0.5);
        [self.selectBtn setBackgroundImage:nil forState:0];
    }
    
    
}
-(void)layoutSubviews{
    [super layoutSubviews];
    self.selectBtn.frame = CGRectMake(0, 0, self.width, 50);
    self.titleLab.frame = CGRectMake(0, 8, self.width, 15);
    self.subTitleLab.frame = CGRectMake(0, self.titleLab.bottom + 5, self.width, 15);
    
}
@end
